package com.sc.nft.controller;




import com.sc.nft.annotation.UserLogin;
import com.sc.nft.entity.dto.CollectionIncrementalLossCalculationDTO;
import com.sc.nft.entity.dto.IncrementalLossCalculationDTO;
import com.sc.nft.entity.vo.IncrementalLossCalculationVO;
import com.sc.nft.pool.UserPool;
import com.sc.nft.service.CollectionGiftService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 藏品赠送(CollectionGift)表控制层
 *
 * @author 王伟成
 * @since 2024-03-16 16:42:10
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("collectionGift")
@Api(tags = "藏品转增需要的条件")
public class CollectionGiftController {
    /**
     * 服务对象
     */
    private final CollectionGiftService collectionGiftService;

    @ApiOperation(value = "转赠损耗计算", notes = "转赠损耗计算", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/incrementalLossCalculation", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<List<IncrementalLossCalculationVO>> incrementalLossCalculation(@Valid @RequestBody CollectionIncrementalLossCalculationDTO incrementalLossCalculationDTO) {
        return Result.success(collectionGiftService.incrementalLossCalculation(incrementalLossCalculationDTO, UserPool.getUser()));
    }
   
}
